
** Additional Standard Error code for table 1 and 2 

********************************************************************************


* Outcomes
global dec "w_dec n_w_dec hcdec sayp huss sayc "
global viol "injuries n_inj viol_p2 viol_p1 viol_s"
global marriage "age_marr age_gap educ_gap workh h_goodjob h_earnless drunk_often"
global wealth "asset1 asset2 modern_cook modern_roof wealth agrland_hec"
global hc "educw primary height lowheight"
global reporting "viol_byothers viol_natal told_anyone sought_help1 sought_help2 sought_help3"

* Covariates and FE
global cov "rural scstbc"
global cov1 "wealth_index hhsize educw"
global cov2 "educh"
global fe1   "i.state i.yy_1marr"
global fe2   "i.state i.yearb"
global did "i.dow_cohort##i.hindu1"
global didid "i.dow_cohort##i.hindu1##i.dow_early"

global cluster "state"


********************************************************************************

* Standard errors

use "$OUTDATA/REDS_sample.dta", clear 

global cov "scstbc rural christian hindu"
global cov1 "years_schooling owns_land hh_members"
global cov2 "years_schooling_spouse"

global fe1   "i.state i.yy_1marr"
global fe2   "i.state i.yearb"
global did 	 "i.dow_cohort##i.hindu1"
global cluster "state"


qui gen dow_99_pos = dow_99
qui replace dow_99_pos = . if dow_99 == 0
qui gen downet_99_pos = downet_99
qui replace downet_99_pos = . if downet_99 == 0

*Matching

	logit hindu1 $cov $cov1 $cov2 yearb 
	predict pscore, pr
	sum pscore

	psmatch2 hindu1, pscore(pscore) noreplace n(1) 

	gen pair = _id if _treated==0 
	replace pair = _n1 if _treated==1
	bysort pair: egen paircount = count(pair)

	eststo: reg dow_99 $did $cov $fe2 if paircount == 2 , r cl($cluster )
	qui sum dow_99 if e(sample)==1
	estadd scalar m =r(mean)
	eststo: reg zdow $did $cov $fe2 if paircount == 2, r cl($cluster )
	qui sum zdow if e(sample)==1
	estadd scalar m =r(mean)

qui gen dow_99_matched = dow_99
qui replace dow_99_matched = . if paircount !=2
qui gen zdow_matched = zdow
qui replace zdow_matched = . if paircount !=2
	
global dow "dow_99 downet_99 dow_99_pos downet_99_pos zdow missingdow dow_99_matched zdow_matched"

** FWER Adj. P-values for Table-1: Dowries
rwolf $dow, indepvar(dowTreat ) controls(hindu1 dow_cohort  $cov $fe2) seed(2000) reps(500) vce(cl state )   


use "$OUTDATA/NFHS_sample.dta", clear 

* Covariates and FE
global cov "rural scstbc"
global cov1 "wealth_index hhsize educw"
global cov2 "educh"
global fe1   "i.state i.yy_1marr"
global fe2   "i.state i.yearb"

logit hindu1 scstbc rural wealth_index hhsize educw educh i.yearb
	predict pscore, pr
	sum pscore
	local c = 0.2*r(sd)

	psmatch2 hindu1, pscore(pscore) noreplace n(1) caliper(`c')

	gen pair = _id if _treated==0 
	replace pair = _n1 if _treated==1
	bysort pair: egen paircount = count(pair)

qui gen w_dec_matched = w_dec
qui replace w_dec_matched = . if paircount !=2
qui gen injuries_matched = injuries
qui replace injuries_matched = . if paircount !=2

global dec "w_dec n_w_dec sayl hcdec huss saysc w_dec_matched"
global viol "injuries n_inj viol_p2 viol_p1 viol_s viol_e injuries_matched"

global marriage "age_marr age_gap educ_gap workh h_goodjob h_earnless drunk_often"
global wealth "asset1 asset2 modern_cook modern_roof agrland_hec wealth_index sl_index "
global hc "educw primary height lowheight"
global reporting "viol_byothers viol_natal told_anyone sought_help1 sought_help2 sought_help3"


** FWER Adj. P-values for Table-2: Bargaining Power and Violence
rwolf $dec [pweight = v005], indepvar(dowTreat ) controls(hindu1 dow_cohort  $cov $fe2) seed(2000) reps(500) vce(cl state ) 

rwolf $viol [pweight = v005], indepvar(dowTreat ) controls(hindu1 dow_cohort  $cov $fe2) seed(2000) reps(500) vce(cl state ) 



********************************************************************************

* Two-way fixed effects, c & d'h (AER, 2020) sd tests (TEH Reobust sigma hat)

use "$OUTDATA/REDS_sample.dta", clear 

global cov "scstbc rural christian hindu"
global cov1 "years_schooling owns_land hh_members"
global cov2 "years_schooling_spouse"

global fe1   "i.state i.yy_1marr"
global fe2   "i.state i.yearb"
global did 	 "i.dow_cohort##i.hindu1"
global cluster "state"


qui gen trt = hindu1*dow_cohort
qui xi i.state i.yearb
qui gen dow_99_pos = dow_99
qui replace dow_99_pos = . if dow_99 == 0
qui gen downet_99_pos = downet_99
qui replace downet_99_pos = . if downet_99 == 0

* Matching

	logit hindu1 $cov $cov1 $cov2 yearb 
	predict pscore, pr
	sum pscore

	psmatch2 hindu1, pscore(pscore) noreplace n(1) 

	gen pair = _id if _treated==0 
	replace pair = _n1 if _treated==1
	bysort pair: egen paircount = count(pair)

	eststo: reg dow_99 $did $cov $fe2 if paircount == 2 , r cl($cluster )
	qui sum dow_99 if e(sample)==1
	estadd scalar m =r(mean)
	eststo: reg zdow $did $cov $fe2 if paircount == 2, r cl($cluster )
	qui sum zdow if e(sample)==1
	estadd scalar m =r(mean)

qui gen dow_99_matched = dow_99
qui replace dow_99_matched = . if paircount !=2
qui gen zdow_matched = zdow
qui replace zdow_matched = . if paircount !=2
	
global dow "dow_99 downet_99 dow_99_pos downet_99_pos zdow missingdow dow_99_matched zdow_matched"

mat def cd_dow = J(2,8,0)
local i = 1

** TEH Robust sigma hat - Table 1: Dowries
foreach y in $dow {

twowayfeweights `y' hindu1 yy_1marr trt, type(feTR) 
mat cd_dow[1,`i'] = e(lb_se_te)
local i = `i' +1
}


use "$OUTDATA/NFHS_sample.dta", clear 

* Covariates and FE
global cov "rural scstbc"
global cov1 "wealth_index hhsize educw"
global cov2 "educh"
global fe1   "i.state i.yy_1marr"
global fe2   "i.state i.yearb"

qui gen trt = hindu1*dow_cohort
qui xi i.state  i.yearb
global dec " w_dec n_w_dec sayl hcdec huss saysc w_dec_matched"
global viol " injuries n_inj viol_p2 viol_p1 viol_s viol_e injuries_matched"



logit hindu1 scstbc rural wealth_index hhsize educw educh i.yearb
	predict pscore, pr
	sum pscore
	local c = 0.2*r(sd)

	psmatch2 hindu1, pscore(pscore) noreplace n(1) caliper(`c')

	gen pair = _id if _treated==0 
	replace pair = _n1 if _treated==1
	bysort pair: egen paircount = count(pair)

qui gen w_dec_matched = w_dec
qui replace w_dec_matched = . if paircount !=2
qui gen injuries_matched = injuries
qui replace injuries_matched = . if paircount !=2


mat def cd_dec = J(2,7,0)
local i = 1

foreach y in $dec {

twowayfeweights `y' hindu1 yy_1marr trt, type(feTR) 
 mat cd_dec[1,`i'] = e(lb_se_te)
local i = `i' +1
	}
	
mat def cd_viol = J(2,7,0)
local i = 1

foreach y in $viol {

** TEH Robust sigma hat - Table 2: Bargaining Power and Violence

Single-user 4-core  perpetual `y' hindu1 yy_1marr trt, type(feTR) 
mat cd_viol[1,`i'] = e(lb_se_te)
local i = `i' +1
	}
	
	
* BJS Estimates for Table 1 and Table 2

use "$OUTDATA/NFHS_sample.dta", clear 


* Macros

* Outcomes

global dec " w_dec n_w_dec sayl hcdec huss saysc "
global viol " injuries n_inj viol_p2 viol_p1 viol_s viol_e "

global marriage "age_marr age_gap educ_gap height_diff workh h_goodjob h_earnless drunk_often"
global wealth "asset1 asset2 modern_cook modern_roof agrland_hec wealth_index sl_index "
global hc "educw primary height lowheight"
global reporting "viol_byothers viol_natal told_anyone sought_help1 sought_help2 sought_help3"

* Covariates and FE
global cov "rural christian hindu scstbc"
global cov1 "wealth_index hhsize educw"
global cov2 "ageh educh workw workh"
global fe1   "i.state i.yy_1marr"
global fe2   "i.state i.yearb"
global did "i.dow_cohort##i.hindu1"

global cluster "state"


cap drop E1 id3

gen E1 = 1985 if hindu1==1
replace E1 = . if hindu1==0
gen id3 = _n

mat def borusyak_dec = J(2,20,0)

global cluster "state"
local i = 1

foreach y in $dec {

	did_imputation `y' id3 yy_1marr E1 [aw= v005] , fe(hindu1 yearb yy_1marr state) controls(scstbc rural) cluster($cluster ) autosample 
	
	mat borusyak_dec[1,`i'] = e(b)[1,1]
	mat borusyak_dec[2,`i'] = e(V)[1,1]
	
	local i = `i' +1
	
	}

logit hindu1 scstbc rural wealth_index hhsize educw educh i.yearb
	cap drop pscore
	predict pscore, pr
	sum pscore
	local c = 0.2*r(sd)

	psmatch2 hindu1, pscore(pscore) noreplace n(1) caliper(`c')

	cap drop pair paircount
	gen pair = _id if _treated==0 
	replace pair = _n1 if _treated==1
	bysort pair: egen paircount = count(pair)
	
	did_imputation w_dec id3 yy_1marr E1 [aw= v005] if paircount == 2, fe(hindu1 yearb yy_1marr state) controls(scstbc rural) cluster($cluster ) autosample 
	
	mat borusyak_dec[1,`i'] = e(b)[1,1]
	mat borusyak_dec[2,`i'] = sqrt(e(V)[1,1])
	

	
mat def borusyak_viol = J(2,20,0)

global cluster "state"
local i = 1

foreach y in $viol {

	did_imputation `y' id3 yy_1marr E1 [aw= v005] , fe(hindu1 yearb yy_1marr state) controls(scstbc rural) cluster($cluster ) autosample 
	
	mat borusyak_viol[1,`i'] = e(b)[1,1]
	mat borusyak_viol[2,`i'] = sqrt(e(V)[1,1])
	
	local i = `i' +1
	
	}

logit hindu1 scstbc rural wealth_index hhsize educw educh i.yearb
	cap drop pscore
	predict pscore, pr
	sum pscore
	local c = 0.2*r(sd)

	psmatch2 hindu1, pscore(pscore) noreplace n(1) caliper(`c')

	cap drop pair paircount
	gen pair = _id if _treated==0 
	replace pair = _n1 if _treated==1
	bysort pair: egen paircount = count(pair)
	
	did_imputation inju id3 yy_1marr E1 [aw= v005] if paircount == 2, fe(hindu1 yearb yy_1marr state) controls(scstbc rural) cluster($cluster ) autosample 
	
	mat borusyak_viol[1,`i'] = e(b)[1,1]
	mat borusyak_viol[2,`i'] = e(V)[1,1]
	
	
	
	
* Macros

use "$OUTDATA/REDS_sample.dta", clear

global cov "scstbc rural christian hindu"
global cov1 "years_schooling owns_land hh_members"
global cov2 "years_schooling_spouse"

global fe1   "i.state i.yy_1marr"
global fe2   "i.state i.yearb"
global did 	 "i.dow_cohort##i.hindu1"
global cluster "state"

global graph "xlabel(, noticks) ylabel(, nogrid) scheme(s2mono) plotregion(fcolor(white) lcolor(white) margin(small)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))"

cap drop E1 id3

gen E1 = 1985 if hindu1==1
replace E1 = . if hindu1==0
gen id3 = _n

mat def borusyak_dow = J(2,20,0)	

	did_imputation dow_99 id3 yy_1marr E1 , fe(hindu1 yearb yy_1marr state) controls(scstbc) cluster($cluster ) autosample 

	mat borusyak_dow[1,1] = e(b)[1,1]
	mat borusyak_dow[2,1] = sqrt(e(V)[1,1])
	
	did_imputation downet_99 id3 yy_1marr E1 , fe(hindu1 yearb yy_1marr state) controls(scstbc) cluster($cluster ) autosample 

	mat borusyak_dow[1,2] = e(b)[1,1]
	mat borusyak_dow[2,2] = sqrt(e(V)[1,1])
	
	did_imputation dow_99 id3 yy_1marr E1 if dow_99>0 , fe(hindu1 yearb yy_1marr state) controls(scstbc) cluster($cluster ) autosampl
	
	mat borusyak_dow[1,3] = e(b)[1,1]
	mat borusyak_dow[2,3] = sqrt(e(V)[1,1])
	
	did_imputation downet_99 id3 yy_1marr E1 if downet_99!=0 , fe(hindu1 yearb yy_1marr state) controls(scstbc) cluster($cluster ) autosample

	mat borusyak_dow[1,4] = e(b)[1,1]
	mat borusyak_dow[2,4] = sqrt(e(V)[1,1])
	
	did_imputation zdow id3 yy_1marr E1 , fe(hindu1 yearb yy_1marr state) controls(scstbc) cluster($cluster ) autosample 

	mat borusyak_dow[1,5] = e(b)[1,1]
	mat borusyak_dow[2,5] = sqrt(e(V)[1,1])
	
	did_imputation missingdow id3 yy_1marr E1 , fe(hindu1 yearb yy_1marr state) controls(scstbc) cluster($cluster ) autosample 

	mat borusyak_dow[1,6] = e(b)[1,1]
	mat borusyak_dow[2,6] = sqrt(e(V)[1,1])
	
* Matching

	logit hindu1 $cov $cov1 $cov2 yearb 
	predict pscore, pr
	sum pscore

	psmatch2 hindu1, pscore(pscore) noreplace n(1) 

	gen pair = _id if _treated==0 
	replace pair = _n1 if _treated==1
	bysort pair: egen paircount = count(pair)

	did_imputation dow_99 id3 yy_1marr E1 if paircount == 2, fe(hindu1 yearb yy_1marr state) controls(scstbc) cluster($cluster ) autosample nose
	
	mat borusyak_dow[1,7] = e(b)[1,1]
	mat borusyak_dow[2,7] = sqrt(e(V)[1,1])
	
	did_imputation zdow id3 yy_1marr E1 if paircount == 2, fe(hindu1 yearb yy_1marr state) controls(scstbc) cluster($cluster ) autosample nose
	
	mat borusyak_dow[1,8] = e(b)[1,1]
	mat borusyak_dow[2,8] = sqrt(e(V)[1,1])
	
	
